#include ("/_includes/_layout.html")
#@layout("", "wxmall,点步科技", "Wxmall社区","wxmall") 
#define content()
<div class="wrapper wrapper-content">
	<div class="row animated fadeInLeft">
	<div class="col-sm-11">
		<div class="row content-tabs">
			<nav class="page-tabs J_menuTabs">
		       <div class="page-tabs-content" style="margin-left: 0px;">
			       <a href="#(webctx)/setting/xiaocx" class="J_menuTab active">小程序</a>
		       </div>
		   	</nav>
		</div>
		<div class="ibox float-e-margins col-sm-10">
			<div class="ibox-title row">
				<h5><small><a href="#(webctx)/setting/xiaocx">《返回小程序列表 / #(authUser.nick_name}</a></small></h5>
			</div>
			<div class="row ibox-content">
				<div class="col-sm-6">
                <div>
                    <div>
                        <form action="" method="post" class="form-horizontal" style="padding-top: 10px;">
							<div>
								<input type="hidden" id="sel_app_id" name="id" value="#(authUser.id}"/>
								<div class="form-group">
						            <label class="col-md-3 control-label">小程序appid</label>
						            <div class="col-md-9" id="error_app_id">
						                <input type="text" id="app_id" name="app_id" class="form-control" value="#(authUser.app_id}" readonly="readonly"/>
						                <label class="control-label" for="app_id"></label>
						            </div>
						        </div>
						        <div class="form-group">
						            <label class="col-md-3 control-label">小程序</label>
						            <div class="col-md-9" id="error_pay_mch_id">
						                <input type="text" id="nick_name" name="nick_name" class="form-control" value="#(authUser.nick_name}" readonly="readonly"/>
						                <label class="control-label" for="nick_name"></label>
						            </div>
						        </div>
						        <div class="form-group">
						            <label class="col-md-3 control-label">小程序Logo</label>
						            <div class="col-md-9">
						                <img style="width: 100px;height: 100px;" src="#(authUser.head_img}"/>
						            </div>
						        </div>	
						        <div class="form-group">
						            <label class="col-md-3 control-label">小程序模板<span style="color: red;"><em>*</em></span></label>
						            <div class="col-md-9" id="error_pay_secret_key">
						                <select id="template_sel" name="template__sel" class="form-control">
						                	<option value="0">小程序商城</option>
						                </select>
						                <label class="control-label" for="template_sel"></label>
						            </div>
						        </div>
							</div>
							<div class="panel-default">
							  	<div class="panel-body" align="center">
									<button id="pack_btn" type="button" class="btn btn-success btn-sm">提交到微信审核</button>
							  	</div>
						  	</div>
					  	</form>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div>
                    <div>
                        <h5>微信官方小程序审核历史记录</h5>
                    </div>
                    <div class="ibox-content">
                        <table class="table table-striped table-bordered bootstrap-datatable datatable">
                            <thead>
                                <tr>
                                    <th>审核编号</th>
                                    <th>状态</th>
                                    <th>审核时间</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody class="itemsLotGrid"></tbody>
                        </table>
                    </div>
                </div>
            </div>
		  	</div>
		</div>
	    <div class="col-sm-2">
	        <div class="wrapper-content">
	            <h4>帮助说明</h4>
	            <ol>
	                <li>打包小程序，并提交到微信审核</li>
	                <li>选择不同的模板，会有对应的小程序功能</li>
	            </ol>
	        </div>
     	</div>	
	</div>
</div>
</div>

<!-- html 模板文件 -->
<script type="text/template" id="item_table_tr_tpl">
{{each data as item i}}
	<tr class="package">
        <td><span class="line">{{item.auditid}}</span></td>
        <td>{{if item.status==2}} 审核中 {{else if item.status==0}} 通过 {{else if item.status==1}} 不通过 <br>原因<i id="imsg_{{id}}" class="fa fa-question-circle" onmouseout="layer.closeAll();" onmouseover="layer.tips('{{item.reason}}', this, {tips: [1, '#3595CC'],time: 0});"></i> {{/if}}</td>
        <td>{{item.updated}}</td>
		<td><a id="showTy_{{item.id}}" href="javascript:void(0)" style="text-decoration: underline;">体验</a>&nbsp;
	<a id="showTy_{{item.id}}" href="javascript:void(0)" style="text-decoration: underline;{{if item.status != 0}}display:none;{{/if}}">发布</a></td>
    </tr>	
{{/each}}
</script>
<script type="text/template" id="table_noresult_tr_tpl">
	<tr class="package"><td colspan="4" class="center">没有结果集</td></tr>
</script>
#end
<script type="text/javascript">
	function listWeappAudit(){
		$(".itemsLotGrid").mask("加载中...");
		obz.ajaxJson(obz.ctx+"/setting/listWeappAuditList", {appId:'#(authUser.app_id}'}, function(resp){
			$(".itemsLotGrid").unmask();
			$('.itemsLotGrid').html(template('item_table_tr_tpl', resp));
		});
	}
	listWeappAudit();
	$("#pack_btn").click(function(){
		$(".ibox-content").mask("正在打包中...");
		obz.ajaxJson("#(webctx)/setting/packpub", {"authAppId":'#(authUser.app_id}', "templateId":$("#template_sel").val()}, function(resp){
			$(".ibox-content").unmask();	
			if(resp.code == 200){
				obz.msg("打包成功，已提交审核");				
			}
		});
	});
</script>